package com.example.ytyproject.controller;


import com.alibaba.fastjson.JSONObject;
import com.example.ytyproject.entity.Role;
import com.example.ytyproject.entity.ShopsBase;
import com.example.ytyproject.entity.User;
import com.example.ytyproject.entity.vo.R;
import com.example.ytyproject.service.ShopsBaseService;
import com.example.ytyproject.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 商铺基本信息表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-04-15
 */
@RestController
@RequestMapping("/shopsBase")
@Slf4j
public class ShopsBaseController {

    @Autowired
    private ShopsBaseService shopsBaseService;

    @PostMapping("/listByPage")
    public R listByPage(@RequestBody ShopsBase param) {
        return shopsBaseService.listByPage(param);
    }

    @PostMapping("/listShop")
    public R listShop() {
        return shopsBaseService.listShop();
    }

    @PostMapping("/addData")
    public R addData(@RequestBody ShopsBase param) {
        log.info("Role addData param: {}", JSONObject.toJSONString(param));
        shopsBaseService.addData(param);
        return R.ok();
    }

    @PostMapping("/updateData")
    public R updateData(@RequestBody ShopsBase param) {
        log.info("Role updateData param: {}", JSONObject.toJSONString(param));
        shopsBaseService.updateData(param);
        return R.ok();
    }
    @DeleteMapping("/deleteData")
    public R deleteData(@Param("id") String id) {
        shopsBaseService.removeById(id);
        return R.ok();
    }
}
